package com.wl2o2o.lanqiao.xzfourteen;
/** 
* @author : WLei224
* @date ：2023年3月30日 上午2:08:28 
* 
*/
import java.util.Scanner;
public class 汉诺塔{
    public static int step = 1;
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()){
            int n = scan.nextInt();
            step = 1;
            hannuota(n,'A','B','C');
        }
    }

    //汉诺塔
    public static void hannuota(int n, char A,char B,char C){
        if(n == 1)System.out.printf("第%03d步，将%03d盘子 %c->%c\n",step++,n,A,C);
        else {
          hannuota(n-1,A,C,B);
          System.out.printf("第%03d步，将%03d盘子 %c->%c\n",step++,n,A,C);
          hannuota(n-1,B,A,C);
          
        }
    }
}
